<template>
  <div>
    <vxe-grid v-bind="grid" ref="xGrid">
      <template #toolbar_buttons>
        <a-space>
          <eip-toolbar></eip-toolbar>
        </a-space>
      </template>
      <template #toolbar_tools> </template>
      <template #loading>
        <a-spin></a-spin>
      </template>
      <template #empty>
        <eip-empty />
      </template>
    </vxe-grid>
  </div>
</template>

<script>
import { query } from "@/services/system/monitor/assemblies";
export default {
  data() {
    return {
      grid: {
        id: "assemblies",
        key: null,
        loading: true,
        height: this.eipTableHeight(),
        printConfig: {},
        exportConfig: {},
        toolbarConfig: {
          slots: {
            buttons: "toolbar_buttons",
            tools: "toolbar_tools",
          },
        },
        columns: [
          { type: "seq", width: 60, fixed: "left" },
          {
            field: "name",
            title: "名称",
            width: 220,
            sortable: true,
            filterRender: {
              name: "MLFilterRender",
            },
            filters: [
              {
                data: {
                  type: "input",
                  key: null,
                  op: "cn",
                  write: null,
                  options: [],
                },
              },
            ],
          },
          {
            field: "version",
            title: "版本号",
            width: 120,
            sortable: true,
            filterRender: {
              name: "MLFilterRender",
            },
            filters: [
              {
                data: {
                  type: "input",
                  key: null,
                  op: "cn",
                  write: null,
                  options: [],
                },
              },
            ],
          },
          {
            field: "clrVersion",
            title: "Clr运行时",
            width: 150,
            sortable: true,
            filterRender: {
              name: "MLFilterRender",
            },
            filters: [
              {
                data: {
                  type: "input",
                  key: null,
                  op: "cn",
                  write: null,
                  options: [],
                },
              },
            ],
          },
          {
            field: "location",
            title: "位置路径",
            minWidth: 150,
            sortable: true,
            filterRender: {
              name: "MLFilterRender",
            },
            filters: [
              {
                data: {
                  type: "input",
                  key: null,
                  op: "cn",
                  write: null,
                  options: [],
                },
              },
            ],
          },
        ],
        proxyConfig: {
          ajax: {
            query: ({ page, sorts, filters }) => {
              return new Promise((resolve) => {
                query().then((result) => {
                  if (result.code == this.eipResultCode.success) {
                    resolve(result.data);
                  }
                  this.grid.loading = false;
                });
              });
            },
          },
        },
      },
    };
  },
};
</script>
